package com.neusoft.neuiotms.dcvm.task.cmdbSyn.respository.impl;

import java.util.List;

import com.neusoft.bizcore.web.jpa.repository.AbstractRepository;
import com.neusoft.neuiotms.dcvm.task.cmdbSyn.model.CmdbSynSrcDataLast;
import com.neusoft.neuiotms.dcvm.task.cmdbSyn.model.QCmdbSynSrcData;
import com.neusoft.neuiotms.dcvm.task.cmdbSyn.model.QCmdbSynSrcDataLast;
import com.neusoft.neuiotms.dcvm.task.cmdbSyn.respository.CustomizedCmdbSynDataLastRepository;

public class CustomizedCmdbSynDataLastRepositoryImpl extends AbstractRepository
        implements CustomizedCmdbSynDataLastRepository {

    @Override
    protected Class<?> getModelClass() {
        return CmdbSynSrcDataLast.class;
    }

    @Override
    public List<CmdbSynSrcDataLast> searchDel(final String assetType) {

        final QCmdbSynSrcData qCmdbSynSrcData = QCmdbSynSrcData.cmdbSynSrcData;
        final QCmdbSynSrcDataLast qCmdbSynSrcDataLast = QCmdbSynSrcDataLast.cmdbSynSrcDataLast;
        final List<CmdbSynSrcDataLast> result = this.query().selectFrom(qCmdbSynSrcDataLast).leftJoin(qCmdbSynSrcData)
                .on(qCmdbSynSrcData.coding.eq(qCmdbSynSrcDataLast.coding))
                .where(qCmdbSynSrcData.coding.isNull(),
                        qCmdbSynSrcDataLast.synCmdb.eq("1"), qCmdbSynSrcDataLast.assetType.eq(assetType))
                .fetch();
        return result;
    }

}
